
<!--
  /**************************************************
  * @ orderresolvereceive.jsp
  *
  * Copyright 2008 Shanghai Auto-Parts E-Procurement Co. Ltd
  * All Rights Reserved.
  *
  * Modify History:
  *  v1.00, 2008/01/23, wangp
  *  1) first release
  /**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<%@ page import="com.hitrust.gs.bean.GSOrderBean" %>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hitrust.gs.bean.GSOrderDetailBean"%>
<%@page import="com.hitrust.gs.util.date.DateUtil"%>
<%@page import="com.hitrust.gs.service.GSBaseManager"%>
<html>
<head>
<title>订单查询明细浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--<LINK href="<%=root%>/css/css.css" type=text/css rel=stylesheet>-->
<link href="css/caigouxitong.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<%
    //String[] tStr = (String[])request.getAttribute("curorderdetail");
    //GSOrderBean tBean = (GSOrderBean)request.getAttribute("orderbean");
    ArrayList tOrderDetailList = (ArrayList)request.getAttribute("OrderDetailList");
    
%>
<%
if(message == null){

%>
<script language="JavaScript">
    var counter;
    
    var totalCount = <%=tOrderDetailList.size()%>;
    
    function process(val){
    	   if(orderrecsigngoodsform.orderDetailIds == null){
               return false;
           }
           if(!isCheckBoxselected(orderrecsigngoodsform,orderrecsigngoodsform.orderDetailIds)){
               alert("请选择一笔订单");
               return false;
           }
        var returnVal = new Array();
        var count = 0;
        var selectedDetailIds = document.orderrecsigngoodsform.orderDetailIds;
        
        if(val == 'C'){
                
        for(var i=0; i<totalCount; i++) {
            if(selectedDetailIds.length > 1) {
                for(i=0; i<selectedDetailIds.length;i++){
                   if(selectedDetailIds[i].checked) {
                   	 var signQtyObj = document.all("signQty_"+i);
          			 var signDateObj = document.all("signDate_"+i);
          			 var num = document.all("Num_"+i);
           			 var remark = document.all("remark_"+i);
          			  var flag='';
          			  if(signQtyObj.value==num.value){
            			flag='Y';
         			   }else{
            			flag='N';
         			   }
          		  		
           		 if(signDateObj.value == "" || signDateObj.value.length != 10) {
              		  alert("第"+(i+1)+"行签收时间不正确。");
		                signDateObj.focus();
		                return false;
          		  }
                   
                     var flags = document.all("flags_"+i);        
                     var ary = new Array();
           			 ary[0] = document.all("OrderDetailId_"+i).value;
       			     ary[1] = signQtyObj.value;
        		     ary[2] = signDateObj.value; 
                     ary[3] = flag;   
                     ary[4] = remark.value;   
                     ary[5] = flags.options[flags.selectedIndex].value;   
                     returnVal[count++] = ary;
                    }
                }
            } else {
             
                if(selectedDetailIds.checked) {
 					 var signQtyObj = document.all("signQty_"+i);
          			 var signDateObj = document.all("signDate_"+i);
          			 var num = document.all("Num_"+i);
           			 var remark = document.all("remark_"+i);
          			  var flag='';
          			  if(signQtyObj.value==num.value){
            			flag='Y';
         			   }else{
            			flag='N';
         			   }
          		  		
           			 if(signDateObj.value == "" || signDateObj.value.length != 10) {
              		 	 alert("第"+(i+1)+"行签收时间不正确。");
		               	 signDateObj.focus();
		               	return false;
          		  	}
                   
 					
                  	var flags = document.all("flags_"+i);     
                    var ary = new Array();
                     ary[0] = document.all("OrderDetailId_"+i).value;
       			     ary[1] = signQtyObj.value;
        		     ary[2] = signDateObj.value; 
                     ary[3] = flag;   
                     ary[4] = remark.value;    
                     ary[5] = flags.options[flags.selectedIndex].value;        
                     returnVal[count++] = ary;
                } 
            } 
        }                  
            if(confirm("是否确定保存录入的收货确认信息?")){
                window.returnValue = returnVal;
                window.close();
            }else{
                return false;
            }
        }
        
    }

    function doSetTotalPrice(index,count) {
            var signQtyObj = document.all("signQty_"+index);
            	if(parseFloat(signQtyObj.value)<=0){
				   alert("本次签收数量必须大于0！")
				   signQtyObj.focus();
				   return false;
			}
			if(parseFloat(signQtyObj.value)>count){
				   alert("本次签收数量不能大于剩余可签收数量！")
				   signQtyObj.focus();
				   return false;
			}
    }
</script>
</head>
<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<form name="orderrecsigngoodsform" method="post" >
<p><br></p>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <td height="20">
            <table width="100%" border="0" cellspacing="0" cellpadding="1">
                <tr height="20">
                    <td height="30" width="758" class="mtxt_black">订单信息
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="bg_line" height="2"></td>
    </tr>
</table>
<br>
    <center>
    <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
    <td>

    <br>
                <table class=bg_table id=tableId    cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20> 
                         <td align=middle class=top>
                        <div class="txt_content">全选<br><input type="checkbox" name="indexs" onClick="SelectAllCheckBox(orderrecsigngoodsform,'orderDetailIds')"></div>
                        </td>  
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">订单明细编号</div>
                        </td>                    
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">集中编码</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品名称</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">是否网上产品</div>
                        </td>                       
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">规格</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">型号</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">品牌</div>
                        </td>
                       <td class=top align=middle> 
                        <div align="center" class="txt_content">供应商</div>
                        </td>                       
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">订货数量</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">单位</div>
                        </td>                       
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">价格（元）</div>
                        </td>                       
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">总价（元）</div>
                        </td>      
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">已签收数量</div>
                        </td>                 
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">本次签收数量</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">签收总价</div>
                        </td>                        
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">签收日期</div>
                        </td>    
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">签收备注</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">是否拒收</div>
                        </td>                                                                                                                                                                                                                                                                                 
                    </tr>
<%
   for(int i=0; i<tOrderDetailList.size(); i++) {
       String[] tStr = (String[])tOrderDetailList.get(i);
%>                    
                            <tr height=20 class="bg_row_odd">
                                <td class=top>                              
                          		<div align="center" class="txt_content">
                          		 <input type="checkbox" id="orderDetailIds<%=i%>" name="orderDetailIds" value="<%=tStr[0]%>">                             
                         		 </div>
                       			</td> 
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[0]%>
                                    <input type="hidden" name="OrderDetailId_<%=i%>" value="<%=tStr[0]%>">
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[1]%>
                                    </div>
                                </td>                               
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <a href="<%=response.encodeURL(root+"/A150103.do")%>?&concentricityId=<%=tStr[1]%>" target="_blank"><%=tStr[2]%></a>
                                    </div>
                                </td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=GSBaseManager.getIsTradeManuf(tStr[15])%>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[3]%>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[4]%>
                                    </div>
                                </td>                       
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[5]%>
                                    </div>
                                </td>                               
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%
                                        String temp = "";
                                        if(tStr[15].equals("0") && tStr[16].equals("0")){
                                            temp = "(采购网配送)";
                                        }
                                    %>
                                    <a href="A400108.do?providerId=<%=tStr[14]%>" target="_blank"><%=tStr[6]%></a><%=temp%>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[7]%>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[8]%>
                                    </div>
                                </td>                                   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[17]%>元                      
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[10]%>元
                                    </div>
                                </td>  
                                
                                 <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                	 <%=tStr[20]%>
                                    </div>
                                </td>  
                                
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <input type="text"  size="6" index="<%=i %>" onblur="doSetTotalPrice(<%=i%>,<%=Double.parseDouble(tStr[7])-Double.parseDouble(tStr[20])%>)" name="signQty_<%=i%>" value="<%=Double.parseDouble(tStr[7])-Double.parseDouble(tStr[20])%>">
                                   <input type="hidden" name="Num_<%=i%>" value="<%=Double.parseDouble(tStr[7])-Double.parseDouble(tStr[20])%>">
                                    </div>
                                </td>  
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                           <span id="signTotalPrice_<%=i%>"><%=tStr[10]%></span>元
                                    </div>
                                </td>                                                                                                                                  
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <input type="text"
                                        name='signDate_<%=i %>' size="15" readonly onfocus='setday(this)'
                                        value="<%=DateUtil.getCurrentDate("yyyy-MM-dd")%>">
                                    </div>
                                </td>     
                                 <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                     <textarea cols=30 rows=2  index="<%=i %>" name="remark_<%=i%>" ></textarea>
                                    </div>
                                </td>  
                                 <td class=top align=middle> 
                             	 	<div align="center" class="txt_content">
                             	 	<%if(tStr[20].equals("0.0")) {%>
                             	 	<select index="<%=i %>" name="flags_<%=i%>" >	
                             	 	<option value="N">否</option>	
									<option value="Y">是</option>	
									</select>	
                             	 	<%}else{ %>
                             	    <select index="<%=i %>" name="flags_<%=i%>" >	
									<option value="N">否</option>	
									</select>	      
                             	     <%} %>                     
                         			</div>
                                </td>                                                                                
                            </tr>     
<%
   }
%>                                      
                        </tbody>
                    </table>    
                <br>    

            </td>
        </tr>
    </table>
    </center>
</form>
    <p align="center">  
<!--        <input type="image" src="images/button/guanbi.gif" width="58" height="24" class="box" onclick="window.close();"/>&nbsp;     -->
        <input type="button" name="确定" value="确定" onClick="process('C')" class="kuang">
        <input type="button" name="取消" value="取消" onClick="window.close()" class="kuang">       
    </p>
 <%
}
 %>
</html>